package cn.iocoder.yudao.module.wine.dal.mysql.uservisitor;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wine.dal.dataobject.uservisitor.UserVisitorDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wine.controller.app.uservisitor.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 访客信息 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface UserVisitorMapper extends BaseMapperX<UserVisitorDO> {

    default PageResult<UserVisitorDO> selectPage(AppUserVisitorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserVisitorDO>()
                .eqIfPresent(UserVisitorDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserVisitorDO::getVisitorId, reqVO.getVisitorId())
                .betweenIfPresent(UserVisitorDO::getAccessTime, reqVO.getAccessTime())
                .betweenIfPresent(UserVisitorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserVisitorDO::getId));
    }

    List<AppUserVisitorListRespVO> getUserVisitorList(@Param("userId") Long userId);
}
